﻿using System;
using GeoAPI.Geometries;
using NetTopologySuite.IO;

namespace NetTopologySuite.Triangulate
{
	public class ConstraintEnforcementException : Exception
	{
		private static string MsgWithCoord(string msg, Coordinate pt)
		{
			if (pt != null)
			{
				return msg + " [ " + WKTWriter.ToPoint(pt) + " ]";
			}
			return msg;
		}

		public ConstraintEnforcementException(string msg) : base(msg)
		{
		}

		public ConstraintEnforcementException(string msg, Coordinate pt) : base(ConstraintEnforcementException.MsgWithCoord(msg, pt))
		{
			this._pt = new Coordinate(pt);
		}

		public Coordinate Coordinate
		{
			get
			{
				return this._pt;
			}
		}

		private readonly Coordinate _pt;
	}
}
